package com.candoit.webapps.pricing.bean.adapters;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;

import com.candoit.webapps.pricing.model.MateriaPrima;
import com.candoit.webapps.pricing.util.QueryUtil;

public class MyTipoPapelConverter implements Converter{

	public Object getAsObject(FacesContext context, UIComponent component,
			String value) {
		return QueryUtil.getInstance().getMateriaByDescription(value);
	}

	public String getAsString(FacesContext context, UIComponent component,
			Object value) {
		MateriaPrima mp = (MateriaPrima) value;
		return mp.getNombre();
	}

}
